home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / File.h,v < prev    next >
Text File  |  1995-06-12  |  7KB  |  323 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.5;
  5. locks    death:1.6; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     93.04.04.23.44.23;  author death;  state Exp;
  11. branches ;
  12. next     1.5;
  13.  
  14. 1.5
  15. date     93.01.10.15.07.53;  author death;  state Exp;
  16. branches ;
  17. next     1.4;
  18.  
  19. 1.4
  20. date     92.07.26.13.57.52;  author death;  state Exp;
  21. branches ;
  22. next     1.3;
  23.  
  24. 1.3
  25. date     92.04.27.20.40.19;  author death;  state Exp;
  26. branches ;
  27. next     1.2;
  28.  
  29. 1.2
  30. date     92.04.05.22.51.05;  author death;  state Exp;
  31. branches ;
  32. next     1.1;
  33.  
  34. 1.1
  35. date     92.03.29.12.18.23;  author death;  state Exp;
  36. branches ;
  37. next     ;
  38.  
  39.  
  40. desc
  41. @This is an early draft of a File object.
  42. @
  43.  
  44.  
  45. 1.6
  46. log
  47. @Sun Apr  4 23:44:23 PDT 1993
  48. @
  49. text
  50. @/*
  51. ====================================================================
  52. This is the interface file for the File class.  Full documentation for this class can be found in the File.rtf file.  I will not duplicate all that fine information here.
  53.     This is $Revision: 1.5 $ of this file
  54.     It was last modified by $Author: death $ on $Date: 93/01/10 15:07:53 $
  55. Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
  56.  *$Log:    File.h,v $
  57.  * Revision 1.5  93/01/10  15:07:53  death
  58.  * Sun Jan 10 15:07:52 PST 1993
  59.  * 
  60.  * Revision 1.4  92/07/26  13:57:52  death
  61.  * Update so all works with the font converter...
  62.  * 
  63.  * Revision 1.2  92/04/05  22:51:05  death
  64.  * Miscelaneous revisions.  This is the last version of  version 1.
  65.  * 
  66.  * Revision 1.1  92/03/29  12:18:23  death
  67.  * Initial revision
  68.  * 
  69.  *====================================================================
  70.  */
  71.  
  72. //
  73. // Import our parent class' definition
  74. //
  75. #import "ResultObject.h"
  76. #import "common.h"
  77. //
  78. //    For stat info...
  79. //
  80. #include <sys/types.h>
  81. #include <sys/stat.h>
  82.  
  83. //
  84. // Define types for positions in the underlying file.
  85. //
  86. typedef    PositiveInteger    FilePos;
  87. typedef    FilePos            FilePosDelta;
  88. typedef    Integer            AccessType;
  89.  
  90. //
  91. //
  92. #define    fileAtEOF                1
  93. #define    fileAtStart                2
  94. #define    fileInMiddle                3
  95.  
  96. //
  97. // Now, define our interface.   Again, see the File.rtf document for general info.
  98. //
  99. @@interface File:ResultObject
  100. {
  101.     CString        FileName;
  102.     AccessType    AccessMode;
  103.     NXStream*    TheFile;
  104.     ino_t        TheInode;
  105.     Integer        FileLocation;
  106.     Boolean        FileIsOpen;
  107. }
  108.     
  109. - initAndUse:(roCString) pathname;
  110. - initAndUseTemporary;
  111. - CreateAndOpenFor: (AccessType) access;
  112. - OpenExistingFor: (AccessType) access;
  113. - ClearAndOpenExistingFor: (AccessType) access;
  114. - ClearAndOpenFor: (AccessType) access;
  115. - OpenFor: (AccessType) access;
  116. - OpenWithAccess: (Integer) operation;
  117. //
  118. - CloseAndDelete;
  119. - Close;
  120. - CloseAndSave;
  121. - free;
  122. //
  123. - AdvanceBytes: (FilePosDelta) byteLoc;
  124. - BackupBytes: (FilePosDelta) byteLoc;
  125. - (CString) GetBasename;
  126. - (FilePos) GetCurrentPosition;
  127. - (CString) GetExtension;
  128. - (CString) GetFilename;
  129. - (CString) GetPathname;
  130. - (CString) GetDirectory;
  131. - MoveTo: (PositiveInteger) byteLoc;
  132. - (Byte) ReadByte;
  133. - Read: (PositiveInteger) numBytes BytesInto: (ByteString) buffer;
  134. - WriteByte: (Byte) theByte;
  135. - Write: (PositiveInteger) numBytes BytesFrom: (ByteString) buffer;
  136. - (PositiveInteger) FileSize;
  137. - FileInfo;
  138. -  (Boolean) SameFileAs: (CString) someOtherFile;
  139. //
  140. //    internal methods
  141. //
  142. -  (CString) GetFullPathFrom: (roCString) pathname;
  143. - ClearFile: (CString) pathname;
  144. - CreateFile: (CString) pathname;
  145. -  (Boolean) FileExists: (CString) pathname;
  146. @@end
  147.  
  148.  
  149.  
  150.  
  151. //
  152. // Now, define some constants used by the class to define the kinds of errors that may occurr
  153. //
  154.  
  155.  
  156. #define FILE_READ            0
  157. #define FILE_WRITE            1
  158. #define FILE_READWRITE    2
  159. #define FILE_APPEND        3
  160. #define FILE_NOACCESS        -1
  161. //
  162. //    Error codes  (using 100 to -300)
  163. //
  164. #define    ERR_STRANGEPATH        50
  165. #define    ERR_BADACCESS        -100
  166. #define    ERR_FILENOTOPEN        -120
  167. #define    ERR_CANTOPEN            -105
  168. #define    ERR_CANTDELETE        -106
  169. #define    ERR_FILEREADONLY    -150
  170. #define    ERR_FILEWRITEONLY    -151
  171. #define    ERR_FILEAPPENDONLY    -152
  172. #define    ERR_NOSUCHFILE        -160
  173. #define    ERR_CREATEFAIL        -170
  174. #define    ERR_FILEEXISTS        -171
  175. #define    ERR_SOMEFILEOPEN    -172
  176. #define    ERR_FILEDOESNTEXIST    -173
  177. #define    ERR_CLEARFAIL        -174
  178. #define    ERR_WRITINGERROR    -200
  179. #define    ERR_FLUSHINGERROR    -201
  180. #define    ERR_WROTEBADCHAR    -202
  181. #define    ERR_READINGERROR    -205
  182. #define    ERR_BADBACKUP        -220
  183. #define    ERR_BADADVANCE        -221
  184. #define    ERR_NODIRECTORY        -250
  185. #define    ERR_CANTGETINFO        -275
  186. #define    ERR_EOF                -225
  187. @
  188.  
  189.  
  190. 1.5
  191. log
  192. @Sun Jan 10 15:07:52 PST 1993
  193. @
  194. text
  195. @d4 2
  196. a5 2
  197.     This is $Revision: 1.4 $ of this file
  198.     It was last modified by $Author: death $ on $Date: 92/07/26 13:57:52 $
  199. d8 3
  200. @
  201.  
  202.  
  203. 1.4
  204. log
  205. @Update so all works with the font converter...
  206. @
  207. text
  208. @d4 2
  209. a5 2
  210.     This is $Revision: 1.2 $ of this file
  211.     It was last modified by $Author: death $ on $Date: 92/04/05 22:51:05 $
  212. d8 3
  213. d134 1
  214. @
  215.  
  216.  
  217. 1.3
  218. log
  219. @misc changes.. (intermediate version)
  220. @
  221. text
  222. @d20 7
  223. a26 2
  224. #import <objc/Object.h>
  225. #import "generalTypes.h"
  226. d31 3
  227. d35 5
  228. a39 2
  229. typedef unsigned long int    FilePos;
  230. typedef FilePos            FilePosDelta;
  231. a40 1
  232.  
  233. d44 1
  234. a44 2
  235.  
  236. @@interface File:Object
  237. d46 6
  238. a51 3
  239.     Cstring    fileName;
  240.     long int    accessType;
  241.     NXStream*    theFile;
  242. d54 23
  243. a76 14
  244. - (id) openFile: (const char *) filename For: (long int) operation;
  245. - (id) openFile: (const char *) filename;
  246. - (id) initFile: (const char *) workingName For: (long int) operation;
  247. - (id) close;
  248. - (id) closeFile;
  249. - (id) advanceBytes: (FilePosDelta) byteLoc;
  250. - (id) backupBytes: (FilePosDelta) byteLoc;
  251. - (Cstring) getBasename;
  252. - (FilePos) getCurrentPosition;
  253. - (Cstring) getExtension;
  254. - (Cstring) getFilename;
  255. - (Cstring) getPathname;
  256. - (Cstring) getDirectory;
  257. - (id) MoveTo: (PositiveInteger) byteLoc;
  258. d78 13
  259. a90 4
  260. - (id) Read: (PositiveInteger) numBytes BytesInto: (ByteString) buffer;
  261. - (id) WriteByte: (Byte) theByte;
  262. - (id) Write: (PositiveInteger) numBytes BytesFrom: (ByteString) buffer;
  263. - (id) FileSize;
  264. d94 2
  265. d100 1
  266. d105 1
  267. a105 3
  268.  
  269.  
  270.  
  271. d107 1
  272. a107 1
  273. //    Error codes
  274. d109 2
  275. d112 19
  276. a130 4
  277. #define    ERR_CANTOPEN        -105
  278. #define    ERR_BADACCESS    -100
  279. #define    ERR_PEACHY        0
  280. #define    ERR_GROOVY        0
  281. @
  282.  
  283.  
  284. 1.2
  285. log
  286. @Miscelaneous revisions.  This is the last version of  version 1.
  287. @
  288. text
  289. @d4 2
  290. a5 2
  291.     This is $Revision: 1.1 $ of this file
  292.     It was last modified by $Author: death $ on $Date: 92/03/29 12:18:23 $
  293. d8 3
  294. d55 6
  295. a60 6
  296. - (id) moveTo: (FilePos) byteLoc;
  297. - (id) readByte;
  298. - (id) read: (long int) numBytes bytesInto: (byte*) buffer retrieving: (long int*) bytesFound;
  299. - (id) writeByte: (byte) theByte;
  300. - (id) write: (long int) numBytes bytesFrom: (byte*) buffer writing: (long int*) bytesWrote;
  301. - (id) fileSize;
  302. @
  303.  
  304.  
  305. 1.1
  306. log
  307. @Initial revision
  308. @
  309. text
  310. @d4 2
  311. a5 2
  312.     This is $Revision:$ of this file
  313.     It was last modified by $Author:$ on $Date:$
  314. d7 4
  315. a10 1
  316.  *$Log:$
  317. d39 4
  318. a42 2
  319. - (id) openFile: (Cstring) filename For: (long int) operation;
  320. - (id) openFile: (Cstring) filename;
  321. d51 1
  322. @
  323.